home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 114 / macaddict114.cdr / Software / Utilities / macam.0.8.4.dmg / macam sources / utilities / BayerConverter.h next >
Encoding:
C/C++ Source or Header  |  2005-11-16  |  4.0 KB  |  109 lines

  1. /*
  2.  macam - webcam app and QuickTime driver component
  3.  Copyright (C) 2002 Matthias Krauss (macam@matthias-krauss.de)
  4.  
  5.  This program is free software; you can redistribute it and/or modify
  6.  it under the terms of the GNU General Public License as published by
  7.  the Free Software Foundation; either version 2 of the License, or
  8.  (at your option) any later version.
  9.  
  10.  This program is distributed in the hope that it will be useful,
  11.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  GNU General Public License for more details.
  14.  
  15.  You should have received a copy of the GNU General Public License
  16.  along with this program; if not, write to the Free Software
  17.  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19.  $Id: BayerConverter.h,v 1.7 2005/11/14 20:38:31 hxr Exp $
  20.  */
  21. #import <Cocoa/Cocoa.h>
  22. #include "GlobalDefs.h"
  23.  
  24. /*
  25. sourceFormat specifies serialization type. Examples show first two lines of a 6-pixel-wide image
  26.  
  27. 1 = GRBG Bayer, sent linear per line, inversed matrix order.    RRRGGG GGGBBB (STV680-type, defaults to this)
  28. 2 = GRBG Bayer, sent interleaved, correct matrix order.         GRGRGR BGBGBG (STV600-type)
  29. 3 = GRBG Bayer, ?/green line, red/blue line            xGxGxG RBRBRB (QuickCam Pro subsampled-style)
  30. 4 = BGGR Bayer, sent interleaved, correct matrix order.         BGBGBG GRGRGR (OV7630-style)
  31. 5 = RGGB Bayer, sent interleaved, correct matrix order.         RGRGRG GBGBGB (rotated BGGR)
  32. */
  33.  
  34. @interface BayerConverter : NSObject {
  35.     float contrast;
  36.     float brightness;
  37.     float gamma;
  38.     float sharpness;
  39.     long saturation;
  40.     long sourceWidth;
  41.     long sourceHeight;
  42.     long destinationWidth;
  43.     long destinationHeight;
  44.     unsigned char redTransferLookup[256];
  45.     unsigned char greenTransferLookup[256];
  46.     unsigned char blueTransferLookup[256];
  47.     unsigned char* rgbBuffer;
  48.     short sourceFormat;
  49.     BOOL updateGains;
  50.     BOOL produceColorStats;
  51.     BOOL needsTransferLookup;
  52. //Individual gains for white balance correction
  53.     float redGain;
  54.     float greenGain;
  55.     float blueGain;
  56. //Average color values of current image
  57.     float meanRed;
  58.     float meanGreen;
  59.     float meanBlue;
  60. //exponentional average sums for components / auto white balance
  61.     float averageRedSum;
  62.     float averageGreenSum;
  63.     float averageBlueSum;
  64.     BOOL averageSumsValid;
  65. }
  66. //Start/stop
  67. - (id) init;
  68. - (void) dealloc;
  69.  
  70. //Get/set properties
  71. - (unsigned long) sourceWidth;
  72. - (unsigned long) sourceHeight;
  73. - (void) setSourceWidth:(long)width height:(long)height;
  74. - (short) sourceFormat;
  75. - (void) setSourceFormat:(short)fmt;
  76. - (unsigned long) destinationWidth;
  77. - (unsigned long) destinationHeight;
  78. - (void) setDestinationWidth:(long)width height:(long)height;
  79. - (float) brightness;    //[-1.0 ... 1.0], 0.0 = no change, more = brighter
  80. - (void) setBrightness:(float)newBrightness;
  81. - (float) contrast;    //[0.0 ... 2.0], 1.0 = no change, more = more contrast
  82. - (void) setContrast:(float)newContrast;
  83. - (float) gamma;    //[0.0 ... 2.0], 1.0 = no change, more = darker grey
  84. - (void) setGamma:(float)newGamma;
  85. - (float) saturation;    //[0.0 ... 2.0], 1.0 = no change, less = less saturation
  86. - (void) setSaturation:(float)newSaturation;
  87. - (float) sharpness;    //[0.0 ... 1.0], 0.0 = no change, more = sharper
  88. - (void) setSharpness:(float)newSharpness;
  89. - (void) setGainsDynamic:(BOOL)dynamic;
  90. - (void) setGainsRed:(float)r green:(float)g blue:(float)b;
  91.  
  92. //Image statistics
  93. - (void) setMakeImageStats:(BOOL)on;     //Enable/Disable construction of average brightness
  94. - (float) lastMeanBrightness;    //Only valid if imageStats are enabled and an image has been processed
  95.  
  96.  
  97. //Dummy decoding (copies b&w image - for debugging)
  98. - (BOOL) copyFromSrc:(unsigned char*)src toDest:(unsigned char*)dst srcRowBytes:(long)srcRB dstRowBytes:(long)dstRB dstBPP:(short)dstBPP;
  99.  
  100. //Do the whole decoding
  101. - (BOOL) convertFromSrc:(unsigned char*)src toDest:(unsigned char*)dst
  102.             srcRowBytes:(long)srcRB dstRowBytes:(long)dstRB dstBPP:(short)dstBPP 
  103.                    flip:(BOOL)flip rotate180:(BOOL)rotate180;
  104.  
  105.  
  106.  
  107.  
  108. @end
  109.